package com.chy.线程;

public class Demo01 {
    private static Object obj = new Object();

    public static void main(String[] args) {
        synchronized (obj) {
            System.out.println("1");
            System.out.println(Thread.currentThread().getName());
            test();
        }
    }

    public static synchronized void test() {
        System.out.println("a");
        System.out.println(Thread.currentThread().getName());
    }
}
